import React from 'react'
import movie_item from '../css/movie_item.scss'
import { Rate } from 'antd'


export default class MovieItem extends React.Component{
    constructor(props){
        super(props)
        this.state={}
    }

    render(){
        return <div onClick={this.goDetail} className={movie_item.box}>
                <img className = {movie_item.image}src={this.props.images.small} referrerPolicy="no-referrer" alt=""/>
                <h4>电影名称: {this.props.title}</h4>
                <h4>上映年份: {this.props.year}</h4>
                <h4>电影类型: {this.props.genres}</h4>
                <Rate allowHalf defaultValue={this.props.rating.average/2} />
        </div>
    }

    goDetail=()=>{
        console.log(this.props.history.push('/movie/detail/'+this.props.id))
    }
}